//
//  UITextField+Validate.h
//  MobileCRM
//
//  Created by winter on 16/2/25.
//  Copyright © 2016年 江苏金恒信息科技有限公司. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "UIView+UserObject.h"

/// require or not   bool
static NSString * const wsValidateRequired =  @"required";
static NSString * const wsValidateRequiredRegex =  @".+";
static NSString * const wsValidateRequireERROR =  @"can not empty";
///minimum length NSInteger
static NSString * const wsValidateMinLength =  @"minLength";
static NSString * const wsValidateMinLengthERROR =  @"too short";
/// maximum length NSInteger
static NSString * const wsValidateMaxLength =  @"maxLength";
static NSString * const wsValidateMaxLengthERROR =  @"too long";
/// regex for value NSString*
static NSString * const wsValidateValueRegex =  @"valueRegex";
static NSString * const wsValidateValueRegexERROR =  @"value is not correct";


/// number or not   bool
static NSString * const wsValidateNumber =  @"number";
static NSString * const wsValidateNumberError =  @"not a number";
///minimum value NSInteger
static NSString * const wsValidateMinValue =  @"minValue";
static NSString * const wsValidateMinValueERROR =  @"value is much smaller";
/// maximum value NSInteger
static NSString * const wsValidateMaxValue =  @"maxValue";
static NSString * const wsValidateMaxValueERROR =  @"value is much bigger";

/// email or not bool
static NSString * const wsValidateEmail =  @"email";
static NSString * const wsValidateEmailRegex =  @"^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$";
static NSString * const wsValidateEmailError =  @"not a email";

/// mobile phone number or not
static NSString * const wsValidateMobile =  @"mobile";
static NSString * const wsValidateMobileRegex =  @"^[1][3578][0-9]{9}$";
static NSString * const wsValidateMobileError =  @"not a mobile phone number";

@interface UITextField(Validate)

/// validate current value by regEx which was added by associated method
///
/// @return validate result nil for correct
- (NSString *)validateValueByAssociatedRegex;

/// validate current value by regEx string
///
/// @params regEx NSString* validate regEx
/// @return validate result
- (BOOL)validateValueByRegEx:(NSString *)regEx;

/*
/// add regex str for validating current value
///
/// @params regEx NSString* validate regEx
/// @return void
- (void)addValidateRegEx:(NSString *)regEx;

/// add regexes str for validating current value
///
/// @params regExes NSArray* validate regEx
/// @return void
- (void)addValidateRegExes:(NSArray *)regExs;
*/

/// add regexes str for validating current value
///
/// @params regExes NSArray* validate regEx
/// @return void
- (void)addValidateRegEx:(NSDictionary *)regEx;

/// remove regexes from self
///
- (void)removeValidateRegExes;



@end
